﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LMKJ.Classes;

namespace LMKJ
{
    public partial class viewitemdetails : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string item_name = Request.QueryString["details"];

                Item i = DatabaseManager.RetrieveItemByName(item_name);

                if (i != null)
                {
                    itemNameLbl.Text = i.Item_name;
                    descriptionLbl.Text = i.Description;
                    priceLbl.Text = "$" + String.Format("{0:0.00}", i.Price);
                }
            }
        }

        protected void editBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("edititem.aspx?details=" + itemNameLbl.Text);
        }

        protected void backBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("searchitems.aspx");
        }
    }
}